/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundary_package;

import Entitys.Fabricante;
import Entitys.Presentacion;
import Entitys.ProductoGeneral;
import Entitys.TipoProducto;
import Helpers.RegexFormatter;
import Helpers.RegularExpression;
import javax.swing.DefaultComboBoxModel;
import services.FabricanteServices;
import services.PresentacionServices;
import services.ProductoGeneralServices;
import services.TipoProductoServices;

/**
 *
 * @author Administrador
 */


public class EditionAdvance extends javax.swing.JPanel {
     private TipoProductoServices tBS=new TipoProductoServices();
     private FabricanteServices fBS=new FabricanteServices();
     private PresentacionServices pRS=new PresentacionServices();
     private ProductoGeneral prod;
     private ProductoGeneralServices pgS=new ProductoGeneralServices();
     private DefaultComboBoxModel LibreComboboxModel=new DefaultComboBoxModel();
     private DefaultComboBoxModel TipoComboboxModel=new DefaultComboBoxModel();
     private DefaultComboBoxModel FabComboboxModel=new DefaultComboBoxModel();
     private DefaultComboBoxModel PreComboboxModel=new DefaultComboBoxModel();
    

    /**
     * Creates new form ReportInvGui
     */
    public EditionAdvance() {
        initComponents();
        LibreComboBoxModelFill();
        TipoComboBoxModelFill();
        PreComboBoxModelFill();
        FabComboBoxModelFill();
        integrity();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        LibrejComboBox = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        TipojComboBox = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        PricejFormattedTextField = new javax.swing.JFormattedTextField();
        ProductNamejFormattedTextField = new javax.swing.JFormattedTextField();
        PrejComboBox = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        FabjComboBox = new javax.swing.JComboBox();
        jButton1 = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "EDICION AVANZADA PRODUCTO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 0, 18))); // NOI18N
        setPreferredSize(new java.awt.Dimension(1240, 640));

        LibrejComboBox.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        LibrejComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        LibrejComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LibrejComboBoxActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        jLabel8.setText("Presentacion:");

        jLabel7.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        jLabel7.setText("Venta Libre:");

        TipojComboBox.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        TipojComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        TipojComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TipojComboBoxActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        jLabel5.setText("Fabricante:");

        jLabel6.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        jLabel6.setText("Tipo de Producto:");

        jLabel4.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        jLabel4.setText("Precio:");

        PricejFormattedTextField.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N

        ProductNamejFormattedTextField.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        ProductNamejFormattedTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ProductNamejFormattedTextFieldActionPerformed(evt);
            }
        });

        PrejComboBox.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        PrejComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel2.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        jLabel2.setText("Nombre de Producto:");

        FabjComboBox.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N
        FabjComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        FabjComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FabjComboBoxActionPerformed(evt);
            }
        });

        jButton1.setFont(new java.awt.Font("Verdana", 0, 18)); // NOI18N
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/Copia de icon_check.png"))); // NOI18N
        jButton1.setText("ACEPTAR");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(105, 105, 105)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(TipojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(47, 47, 47)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(PrejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(78, 78, 78)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(LibrejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ProductNamejFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 729, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(38, 38, 38)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(PricejFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(35, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addComponent(FabjComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ProductNamejFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(PricejFormattedTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel4))
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel8)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FabjComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TipojComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(LibrejComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(41, 41, 41)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(29, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void TipojComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TipojComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TipojComboBoxActionPerformed
 public void LibreComboBoxModelFill(){
            this.LibreComboboxModel.addElement("Si");
            this.LibreComboboxModel.addElement("No");
            LibrejComboBox.setModel(LibreComboboxModel);
 }
 
 public void TipoComboBoxModelFill(){
     
            this.TipoComboboxModel.addElement("Seleccione");
           for(TipoProducto tip:tBS.readAll()){
           this.TipoComboboxModel.addElement(tip.getTipo());
           }
            TipojComboBox.setModel(TipoComboboxModel);
 }
 
 public void FabComboBoxModelFill(){
           this.FabComboboxModel.addElement("Seleccione");
           for(Fabricante fab:fBS.readAll()){
           this.FabComboboxModel.addElement(fab.getNombreFabricante());
           }
     
          FabjComboBox.setModel(FabComboboxModel);
 }
 
 public void PreComboBoxModelFill(){
            this.PreComboboxModel.addElement("Seleccione");
           for(Presentacion pre:pRS.readAll()){
           this.PreComboboxModel.addElement(pre.getTipoPresentacion());
           }
     
          PrejComboBox.setModel(PreComboboxModel);
 }
    private void ProductNamejFormattedTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ProductNamejFormattedTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ProductNamejFormattedTextFieldActionPerformed

    private void FabjComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FabjComboBoxActionPerformed
        // TODO add your handling code here:


  }//GEN-LAST:event_FabjComboBoxActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
       
    }//GEN-LAST:event_jButton1ActionPerformed

    private void LibrejComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LibrejComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_LibrejComboBoxActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox FabjComboBox;
    private javax.swing.JComboBox LibrejComboBox;
    private javax.swing.JComboBox PrejComboBox;
    private javax.swing.JFormattedTextField PricejFormattedTextField;
    private javax.swing.JFormattedTextField ProductNamejFormattedTextField;
    private javax.swing.JComboBox TipojComboBox;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    // End of variables declaration//GEN-END:variables

    private void integrity() {
//        new RegexFormatter(RegularExpression.WORDS).install(this.ProductNamejFormattedTextField);
        new RegexFormatter(RegularExpression.NATURAL_NUMBERS).install(this.PricejFormattedTextField);
        
    }
}
